//
//  XDBMyUserInfoheaderView.m
//  xindailianmeng
//
//  Created by 张东 on 2017/2/17.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDBMyUserInfoheaderView.h"

@interface XDBMyUserInfoheaderView ()

@property (nonatomic, weak) UILabel *lb;

@end

@implementation XDBMyUserInfoheaderView


- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        [self setUI];
        
        
    }
    
    return self;
}

- (void)setUI {
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, 30)];
    view.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:view];
    
    UILabel *lb = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, kScreenW, 30)];
    lb.textColor = kColorRGB(187,147,115);
    lb.textAlignment = NSTextAlignmentLeft;
    lb.font = kBaseFont_(12);
    self.lb = lb;
    [view addSubview:lb];
    
    UIView *carveView = [[UIView alloc] initWithFrame:CGRectMake(15, 29.5, kScreenW - 30, 0.5)];
    carveView.backgroundColor = kColorRGBA(0, 0, 0, 0.1);
    [view addSubview:carveView];
}

- (void)setHeaderStr:(NSString *)headerStr {
    
    _headerStr = headerStr;
    
    NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
    fmt.dateFormat = @"yyyy-MM-dd";
    NSDate *date = [fmt dateFromString:headerStr];
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.dateFormat = @"yyyy年MM月";
    self.lb.text = [dateFormatter stringFromDate:date];
 
}
@end
